import React, { useEffect } from 'react';

import { myConnect } from '../../components/MyAdvance';

const ComingSoon = (props) => {
  console.log('ComingSoon', props);

  let { coming, leaving } = props;
  useEffect(() => {
    coming();

    return () => {
      leaving({ a1: 1, b1: 2 });
    };
  }, [coming, leaving]);

  return <div>ComingSoon</div>;
};

const MapStateToPropsParam = (state) => {
  console.log('ComingSoon MapStateToPropsParam', state);
  return {
    a: 1,
    b: 2,
  };
};

const MapDispatchToPropsParam = {
  coming: () => {
    console.log('coming');
  },
  leaving: (...args) => {
    console.log('leaving', args);
  },
};
export default myConnect(
  MapStateToPropsParam,
  MapDispatchToPropsParam
)(ComingSoon);
